ReactiveCommand class¶
Attributes: [DebuggerDisplay("CanExecute = {_canExecuteValue}, IsExecuting = {_isExecutingValue}, InFlight = {_inFlight}")]
Defined in
Namespace: ReactiveUI.Reactive
Assembly: ReactiveUI.Reactive.dll
Full name: ReactiveUI.Reactive.ReactiveCommand<T1, T2>
Modifiers: public
Summary¶
Encapsulates a user interaction behind a reactive interface.
Applies to
net10.0, net10.0-maccatalyst26.0, net10.0-desktop1.0, net10.0-browserwasm1.0, net10.0-tvos26.0, net10.0-windows10.0.19041, net10.0-macos26.0, net10.0-ios26.0, net10.0-android36.0, net9.0, net9.0-tvos18.0, net9.0-macos15.0, net9.0-maccatalyst18.0, net9.0-windows10.0.19041, net9.0-ios18.0, net9.0-desktop1.0, net8.0, net8.0-windows10.0.19041, net8.0-ios18.0, net8.0-maccatalyst18.0, net8.0-macos15.0, net8.0-tvos18.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.5, netstandard2.1, net481, net462, net471
Class hierarchy
classDiagram
class ReactiveCommand~T1,T2~
class ReactiveCommandBase~TParam, TResult~
ReactiveCommandBase~TParam, TResult~ <|-- ReactiveCommand~T1,T2~
Inherits from: ReactiveCommandBase
Remarks¶
This class provides the bulk of the actual implementation for reactive commands. You should not create instances
of this class directly, but rather via the static creation methods on the non-generic ReactiveCommand
class. The execution state (CanExecute, IsExecuting, results and exceptions) is held in
inline fields and fanned out through lightweight Broadcaster streams rather than subjects; the
canExecute / isExecuting state is recomputed inline (userCanExecute && inFlight == 0) under a single gate.
State transitions driven by execution begin/end, results and exceptions are scheduled onto the output scheduler;
values returned directly from Execute are delivered on the execution thread.
Constructors¶
| Name | Summary |
|---|---|
| .ctor | Initializes a new instance of the [ReactiveCommand](# class for work that signals cancellation through a separate callback (as opposed to cancelling by... |
Properties¶
| Name | Summary |
|---|---|
| CanExecute | Gets an observable whose value indicates whether the command can currently execute. |
| IsExecuting | Gets an observable whose value indicates whether the command is currently executing. |
| ThrownExceptions | Gets a observable which will fire whenever an exception would normally terminate ReactiveUI internal state. |
Methods¶
| Name | Summary |
|---|---|
| Execute | Gets an observable that, when subscribed, executes this command. |
| Subscribe | Subscribes to execution results from this command. |
| Dispose | Disposes of the managed resources. |